<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>编辑店铺</title>
<link rel="stylesheet" rev="stylesheet" href="<c:url value="/styles/ad/style.css"/>" type="text/css"/>
<script language="JavaScript" type="text/javascript" src="<c:url value="/scripts/jquery-1.4.4.min.js"/>"></script>
<script language="JavaScript" type="text/javascript">
var nameOk = true;
var telOk = true;
function saveDpgl(){
	var dpname = jQuery.trim($("#dpname").val());
	var fzrtel = jQuery.trim($("#dpfzrtel").val());
	var reg =  new RegExp("((\\d{11})|^((\\d{7,8})|(\\d{4}|\d{3})-(\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1})|(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1}))$)");
	if(dpname == ""){
		$("#yesOrNo")
		 .css("color","red").text("店铺名称必填");
		if(fzrtel != ""){
			if(!reg.test(fzrtel)){
				$("#telval").css("color","red").text("联系方式格式错误");
				telOk = false;
			}else{
				$("#telval").css("color","green").text("格式正确");
				telOk = true;
			}
		}
		return false;
	}else{
		if(fzrtel != ""){
			if(!reg.test(fzrtel)){
				$("#telval").css("color","red").text("联系方式格式错误");
				telOk = false;
			}else{
				$("#telval").css("color","green").text("格式正确");
				telOk = true;
			}
		}
		if(nameOk && telOk){
			return true;
		}else{
			return false;
		}
	}
}

//验证联系方式
function validTel(){
	var fzrtel = jQuery.trim($("#dpfzrtel").val());
	var reg =  new RegExp("((\\d{11})|^((\\d{7,8})|(\\d{4}|\d{3})-(\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1})|(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1}))$)");
	if(fzrtel == ""){
		$("#telval").text("");
		telOk = true;
	}else{
		if(!reg.test(fzrtel)){
			$("#telval").css("color","red").text("联系方式格式错误");
			telOk = false;
		}else{
			$("#telval").css("color","green").text("格式正确");
			telOk = true;
		}
	}
}
</script>
<style type="text/css">
<!--
.atten {font-size:12px;font-weight:normal;color:#F00;}
-->
</style>
</head>

<body class="ContentBody">
  <form action="editdpglOption" method="post" name="form">
  <input type="hidden" value="${dpgl.dpcode}" name="dpcodeVal"/>
<div class="MainDiv">
<table width="99%" border="0" cellpadding="0" cellspacing="0" class="CContent">
  <tr>
      <th class="tablestyle_title" >店铺编辑页面</th>
  </tr>
  <tr>
    <td class="CPanel">
		<table border="0" cellpadding="0" cellspacing="0" style="width:100%">
		<tr>
			<td align="left">
				<input type="submit" name="Submit" value="保存" class="button" onclick="return saveDpgl();"/>　			
				<input type="button" name="Submit2" value="返回" class="button" onclick="window.history.go(-1);"/>			</td>
		</tr>
			<TR>
			<TD width="100%">
				<fieldset style="height:100%;">
				<legend>修改店铺信息</legend>
					  <table border="0" cellpadding="2" cellspacing="1" style="width:100%">
					 
					  <tr>
					    <td nowrap align="right" width="15%">店铺编号:</td>
					    <td width="35%"><input name='dpcode' class="text" style="width:154px" value="${dpgl.dpcode}" disabled="disabled"/>
				        <span class="red">*</span></td>
					    <td width="16%" align="right" nowrap="nowrap">店铺名称:</td>
					    <td width="34%"><input class="text" name='dpname' style="width:154px" id="dpname" value="${dpgl.dpname}" disabled="disabled"/>
					    <span class="red">*</span>
					    </td>
					  </tr>
					    
					    
					  <tr>
					    <td nowrap="nowrap" align="right">经营范围:</td>
					    <td><input class="text" name='dpjyfw' style="width:154px" value="${dpgl.dpjyfw}"/></td>
					    <td align="right">经营大类:</td>
					    <td>
					    <select name="cpdlSel">
					    <c:forEach items="${cpdlList}" var="cpdl">
					        <option value="${cpdl.dlcode}" <c:if test="${cpdl.dlcode eq dpgl.dpdlstyle}">selected="selected"</c:if>>${cpdl.dlname}</option>
					    </c:forEach>
					    </select></td>
					  </tr>
					  <tr>
					    <td align="right">店铺负责人:</td>
					    <td>
					        <input class="text" name='dpfzr' style="width:154px" value="${dpgl.dpfuzeren}"/>
						</td>
					    <td align="right">负责人联系方式:</td>
					    <td>
					        <input class="text" name='dpfzrtel' id="dpfzrtel" style="width:154px" value="${dpgl.fzrtel}" onblur="validTel()"/>
					        <span id="telval"></span>
						</td>
					  </tr>
					  <tr>
					    <td align="right">店铺商家介绍:</td>
					    <td colspan="3"><textarea name="dpgljs" cols="100" rows="8">${dpgl.dpsjjs}</textarea></td>
					  </tr>
					  <tr>
					    <td align="right">店铺付款说明:</td>
					    <td colspan="3"><textarea name="dgglfksm" cols="100" rows="8">${dpgl.fukuanstyle}</textarea></td>
					  </tr>
					  <tr>
					    <td align="right">配送说明:</td>
					    <td colspan="3"><textarea name="pssm" cols="100" rows="8">${dpgl.peisong }</textarea></td>
					  </tr>
					  <tr>
					    <td align="right">积分兑换说明:</td>
					    <td colspan="3"><textarea name="jfdhsm" cols="100" rows="8">${dpgl.jjfenduihuan}</textarea></td>
					  </tr>
					  </table>
			  <br />
				</fieldset>			</TD>
		</TR>
		</TABLE>
	
	
	 </td>
  </tr>
		<TR>
			<TD colspan="2" align="center" height="50px">
			<input type="submit" name="Submit" value="保存" class="button" onclick="return saveDpgl();"/>　
			
			<input type="button" name="Submit2" value="返回" class="button" onclick="window.history.go(-1);"/></TD>
		</TR>
		</TABLE>
	 </td>
  </tr>
  
  
  
  </table>

</div>
</form>
</body>
</html>